Skip to contentSkip to conversation

Change in openvpn[master]: Fix --dns options for TAP adapter

Openvpn-devel In review stipa (Code Review) 2 participants 9 messages Jul 31, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1753953375000.Id95cd14095a03afb3140a03ae96e9f5679e4fe89@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1120?usp=email

to review the following change.

Change subject: Fix --dns options for TAP adapter
......................................................................

Fix --dns options for TAP adapter

Commit

2dfc4f ("dns: deal with --dhcp-options when --dns is active")

has accidentally removed setting of the DHCP_OPTIONS_DHCP_OPTIONAL flag when copying --dns options. This flag is required to apply options via DHCP string, which we do for TAP adapter. As a result, --dns options stopped working for TAP.

Fix by setting this flag when copying --dns options to tuntap_options.

Change-Id Id95cd14095a03afb3140a03ae96e9f5679e4fe89

---
M src/openvpn/options.c

1 file changed, 3 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/20/1120/1

src/openvpn/options.c +3 -0
index 53be6f5..fde3e73 100644
@@ -3579,6 +3579,9 @@
             {
                 msg(M_WARN, "WARNING: couldn't copy all --dns server addresses to TUN/TAP");
             }
+#if defined(_WIN32)
+            tt->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
+#endif
             return;
         }
     }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1120?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id95cd14095a03afb3140a03ae96e9f5679e4fe89
Gerrit-Change-Number: 1120
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1120?usp=email )

Change subject: Fix --dns options for TAP adapter
......................................................................

Patch Set 1: Code-Review-1

(1 comment)

File src/openvpn/options.c:

http://gerrit.openvpn.net/c/openvpn/+/1120/comment/d02b145c_6d172850 :
PS1, Line 3582: #if defined(_WIN32)
As this is inside an #if defined(_WIN32) || defined(TARGET_ANDROID) block and dhcp_options is part of the tuntap_options for both platforms, I think we can avoid that #ifdef

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1120?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id95cd14095a03afb3140a03ae96e9f5679e4fe89
Gerrit-Change-Number: 1120
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 31 Jul 2025 09:29:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld, plaisthos, stipa.

Hello cron2, flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1120?usp=email

to look at the new patch set (#2).

The following approvals got outdated and were removed:
Code-Review-1 by cron2

Change subject: Fix --dns options for TAP adapter
......................................................................

Fix --dns options for TAP adapter

Commit

2dfc4f ("dns: deal with --dhcp-options when --dns is active")

has accidentally removed setting of the DHCP_OPTIONS_DHCP_OPTIONAL flag when copying --dns options. This flag is required to apply options via DHCP string, which we do for TAP adapter. As a result, --dns options stopped working for TAP.

Fix by setting this flag when copying --dns options to tuntap_options.

Change-Id Id95cd14095a03afb3140a03ae96e9f5679e4fe89

---
M src/openvpn/options.c

1 file changed, 1 insertion(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/20/1120/2

src/openvpn/options.c +1 -0
index 53be6f5..3753810 100644
@@ -3579,6 +3579,7 @@
             {
                 msg(M_WARN, "WARNING: couldn't copy all --dns server addresses to TUN/TAP");
             }
+            tt->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
             return;
         }
     }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1120?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id95cd14095a03afb3140a03ae96e9f5679e4fe89
Gerrit-Change-Number: 1120
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1120?usp=email )

Change subject: Fix --dns options for TAP adapter
......................................................................

Patch Set 2: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1120?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id95cd14095a03afb3140a03ae96e9f5679e4fe89
Gerrit-Change-Number: 1120
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 31 Jul 2025 10:48:12 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#5 lore raw

PATCH v2 1/1 Fix --dns options for TAP adapter

In reply to a message not in the archive

From: Lev Stipakov <[email protected]...>

Commit

2dfc4f ("dns: deal with --dhcp-options when --dns is active")

has accidentally removed setting of the DHCP_OPTIONS_DHCP_OPTIONAL flag when copying --dns options. This flag is required to apply options via DHCP string, which we do for TAP adapter. As a result, --dns options stopped working for TAP.

Fix by setting this flag when copying --dns options to tuntap_options.

Change-Id Id95cd14095a03afb3140a03ae96e9f5679e4fe89

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1120
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/options.c +1 -0
index 53be6f5..3753810 100644
@@ -3579,6 +3579,7 @@
             {
                 msg(M_WARN, "WARNING: couldn't copy all --dns server addresses to TUN/TAP");
             }
+            tt->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
             return;
         }
     }
#6 lore raw

[Openvpn-devel] [PATCH applied] Re: Fix --dns options for TAP adapter

I have stared at the code, and together with the findings from the previous commit (040e0d1c) this very much looks like the right fix.

I haven't tested it myself, just let the BBs compile-test on all platforms (especially win32 <-> android, given the #ifdefs in the neighbourhood)

Your patch has been applied to the master branch.

commit 264fe91660fb1a7a426161a9a042ed3f9bd0a7a6

Author: Lev Stipakov
Date:   Thu Jul 31 12:48:27 2025 +0200
     Fix --dns options for TAP adapter

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg32436.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#7 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#3) to the change originally created by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/1120?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: Fix --dns options for TAP adapter
......................................................................

Fix --dns options for TAP adapter

Commit

2dfc4f ("dns: deal with --dhcp-options when --dns is active")

has accidentally removed setting of the DHCP_OPTIONS_DHCP_OPTIONAL flag when copying --dns options. This flag is required to apply options via DHCP string, which we do for TAP adapter. As a result, --dns options stopped working for TAP.

Fix by setting this flag when copying --dns options to tuntap_options.

Change-Id Id95cd14095a03afb3140a03ae96e9f5679e4fe89

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32436.html

---
M src/openvpn/options.c

1 file changed, 1 insertion(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/20/1120/3

src/openvpn/options.c +1 -0
index 53be6f5..3753810 100644
@@ -3579,6 +3579,7 @@
             {
                 msg(M_WARN, "WARNING: couldn't copy all --dns server addresses to TUN/TAP");
             }
+            tt->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
             return;
         }
     }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1120?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id95cd14095a03afb3140a03ae96e9f5679e4fe89
Gerrit-Change-Number: 1120
Gerrit-PatchSet: 3
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#8 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1120?usp=email )

Change subject: Fix --dns options for TAP adapter
......................................................................

Fix --dns options for TAP adapter

Commit

2dfc4f ("dns: deal with --dhcp-options when --dns is active")

has accidentally removed setting of the DHCP_OPTIONS_DHCP_OPTIONAL flag when copying --dns options. This flag is required to apply options via DHCP string, which we do for TAP adapter. As a result, --dns options stopped working for TAP.

Fix by setting this flag when copying --dns options to tuntap_options.

Change-Id Id95cd14095a03afb3140a03ae96e9f5679e4fe89

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32436.html

---
M src/openvpn/options.c

1 file changed, 1 insertion(+), 0 deletions(-)
src/openvpn/options.c +1 -0
index 53be6f5..3753810 100644
@@ -3579,6 +3579,7 @@
             {
                 msg(M_WARN, "WARNING: couldn't copy all --dns server addresses to TUN/TAP");
             }
+            tt->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
             return;
         }
     }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1120?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id95cd14095a03afb3140a03ae96e9f5679e4fe89
Gerrit-Change-Number: 1120
Gerrit-PatchSet: 3
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged

#9 lore raw
In reply to a message not in the archive

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1120?usp=email )

Change subject: Fix --dns options for TAP adapter
......................................................................

Patch Set 3:

(1 comment)

File src/openvpn/options.c:

http://gerrit.openvpn.net/c/openvpn/+/1120/comment/b766abff_4d3f8bdb :
PS1, Line 3582: #if defined(_WIN32)

Quoted 1 line

As this is inside an #if defined(_WIN32) || defined(TARGET_ANDROID) block and dhcp_options is pa […]

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1120?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id95cd14095a03afb3140a03ae96e9f5679e4fe89
Gerrit-Change-Number: 1120
Gerrit-PatchSet: 3
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Comment-Date: Thu, 31 Jul 2025 12:42:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment